package com.sduept.nwld.dataserver.controller.rota;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import org.primefaces.event.CellEditEvent;
import org.primefaces.event.ScheduleEntryMoveEvent;
import org.primefaces.event.ScheduleEntryResizeEvent;
import org.primefaces.event.SelectEvent;
import org.primefaces.model.DefaultScheduleEvent;
import org.primefaces.model.LazyScheduleModel;
import org.primefaces.model.ScheduleEvent;
import org.primefaces.model.ScheduleModel;
import org.springframework.beans.factory.annotation.Autowired;

import com.sduept.bigdata.web.jsf.controller.AbstractController;
import com.sduept.generator.ObjectId;
import com.sduept.nwld.dataserver.manager.rota.HolidayManager;
import com.sduept.nwld.dataserver.manager.rota.RotaManager;
import com.sduept.nwld.dataserver.manager.rota.RotaOrderManager;
import com.sduept.nwld.dataserver.manager.rota.RotaPersonManager;
import com.sduept.nwld.dataserver.model.rota.HolidayInfo;
import com.sduept.nwld.dataserver.model.rota.RotaInfo;
import com.sduept.nwld.dataserver.model.rota.RotaOrder;
import com.sduept.nwld.dataserver.model.rota.RotaPerson;
import com.sduept.permission.entity.DepartmentEntityBean;
import com.sduept.permission.entity.PersonnelEntityBean;
import com.sduept.permission.manager.DepartManager;
import com.sduept.permission.manager.PersonnelManager;
import com.sduept.utils.DateUtil;
import com.sduept.utils.PingYinUtil;

@Named
@ViewScoped
public class RotaController extends AbstractController{

	private static final long serialVersionUID = -2395237181971018890L;
	@Autowired
	private RotaManager rotaManager;
	@Autowired
	private HolidayManager holidayManager;
	@Autowired
	private DepartManager dm;	
	@Autowired
	private RotaOrderManager rotaOrderManager;
	@Autowired
	private RotaPersonManager rotaPersonManager;
	@Autowired
	private PersonnelManager pm;
	
	private ScheduleModel lazyEventModel;
    private ScheduleEvent event = new DefaultScheduleEvent();    
    private Date rotaDate;
    //holidayDates集合
    private List<Date> holidayDates;    
    private RotaOrder rotaOrder = new RotaOrder();
    private RotaOrder selectRotaOrder = new RotaOrder();
    private RotaPerson selectRotaPerson = new RotaPerson();
	private List<RotaOrder> rotaOrders = new ArrayList<RotaOrder>();
	private List<RotaPerson> _rotaPersons = new ArrayList<RotaPerson>();
	private List<RotaPerson> rotaPersons = new ArrayList<RotaPerson>();
    private RotaPerson rotaPerson = new RotaPerson();
    private String selectDate;
    private int year=0;
    private int roundRule=0;
	@PostConstruct
    public void init() {		
		initRotaOrder();
		initRotaPersons();
        lazyEventModel = new LazyScheduleModel() {        
			private static final long serialVersionUID = -899214046611669432L;
			@Override
            public void loadEvents(Date start, Date end) {
				Date _start=DateUtil.getDateByString(DateUtil.getStringDate(start, DateUtil.pattern_ymd),DateUtil.pattern_ymd);
				Date _end=DateUtil.getDateByString(DateUtil.getStringDate(end, DateUtil.pattern_ymd),DateUtil.pattern_ymd);
				List<RotaPerson> __rpweekInfos=rotaPersonManager.findAllWeekRotaPersonsBetweenStartDateAndEndDate(_start, _end);
				if(__rpweekInfos!=null && !__rpweekInfos.isEmpty()){
					for(RotaPerson _rpweekInfo:__rpweekInfos){
						addEvent(new DefaultScheduleEvent(_rpweekInfo.getPersonName(), addOneDay(_rpweekInfo.getRotaDate()),addOneDay(_rpweekInfo.getRotaDate())));
					}
				}
            }   
        };
    }
	
	private void initRotaPersons() {
		rotaPersons=rotaPersonManager.findAllWeekRotaPerson();
		if(rotaPersons==null)
			rotaPersons=new ArrayList<RotaPerson>();
	}
	
	public void reOrder() {
		int max = 0;
		for (RotaOrder bean : rotaOrders) {
			if(bean.getRotaOrder() > max) {
				max = bean.getRotaOrder();
			}
		}
		for (RotaOrder bean : rotaOrders) {
			bean.setRotaOrder(max + 1 - bean.getRotaOrder());
			rotaOrderManager.updateRotaOrder(bean);
		}
	}
	
	public void findAll() {
		rotaDate = null;
		initRotaPersons();
	}
	
	public void preCreateRotaPerson() {
		rotaPerson = new RotaPerson();
	}
	
	public void preEditRotaPerson() {
		rotaPerson = selectRotaPerson;
	}
	
	public void queryByTime() {
		if(rotaDate!=null){
			rotaPersons = rotaPersonManager.findRotaPersonByRoteDate(rotaDate);
		}else{
			initRotaPersons();
		}
	}
	
	@SuppressWarnings("static-access")
	public void saveRotaPerson() {
		if(rotaPerson != null) {			
			if(rotaPerson.getId() == null) {//新建
				if(rotaOrder!=null){
					Calendar cal=Calendar.getInstance();
					if(rotaPerson.getRotaDate()!=null){
						cal.setTime(rotaPerson.getRotaDate());						
						rotaPerson.setYear(cal.get(cal.YEAR));
					}else{
						addErrorMessage("未选择日期，保存失败");
						return;
					}if(!"null-".equals(rotaOrder.toString())){
						rotaPerson.setPersonId(rotaOrder.toString().split("-")[1]);
						rotaPerson.setPersonName(rotaOrder.toString().split("-")[2]);
					}else if(rotaPerson.getPersonName()==null || rotaPerson.getPersonName().isEmpty()){
						addErrorMessage("未选择值班人，保存失败");
						return;
					}
					rotaPerson.setRemark("第"+(cal.get(Calendar.WEEK_OF_YEAR)+1)+"周周"+cal.get(cal.DAY_OF_WEEK));
					rotaPersonManager.createRotaPerson(rotaPerson);
					rotaPersons.add(rotaPerson);
				}else{
					addErrorMessage("未选择值班人，保存失败");
					return;
				}
			} else { //编辑
				if(rotaOrder!=null&&rotaOrder.getPersonName()!=null){
					if(rotaPerson.getRotaDate()!=null){
						Calendar cal=Calendar.getInstance();
						cal.setTime(rotaPerson.getRotaDate());						
						rotaPerson.setYear(cal.get(cal.YEAR));
						rotaPerson.setRemark("第"+(cal.get(Calendar.WEEK_OF_YEAR)+1)+"周周"+cal.get(cal.DAY_OF_WEEK));
					}else{
						addErrorMessage("未选择日期，保存失败");
						return;
					}
					if(!"null-".equals(rotaOrder.toString())){
						rotaPerson.setPersonId(rotaOrder.toString().split("-")[1]);
						rotaPerson.setPersonName(rotaOrder.toString().split("-")[2]);
					}else if(rotaPerson.getPersonName()==null || rotaPerson.getPersonName()==null){
						addErrorMessage("未选择值班人，保存失败");
						return;
					}
				}
				rotaPersonManager.updateRotaPerson(rotaPerson);
				//selectRotaPerson = new RotaPerson();
			}
			rotaOrder=new RotaOrder();
			addSuccessMessage("保存成功");
		}
	}
	
	public void deleteRotaPerson() {
		if(selectRotaPerson != null) {
			rotaPersonManager.delRotaPerson(selectRotaPerson.getId());
			rotaPersons.remove(selectRotaPerson);
			addSuccessMessage("删除成功！");
		} else {
			addErrorMessage("请选择记录");
		}
		selectRotaPerson = null;
	}

	/**
	 * 重新初始化继电保护处周末值班表
	 */
	public void reInitRotaPersonInfo(){
		initRotaPersons();
		if(year!=0)
			initRotaPersonInfo(year,roundRule);
		else 
			initRotaPersonInfo(Calendar.getInstance().get(Calendar.YEAR),roundRule);
	}
	/**
	 * 初始化周末值班表   
	 */
	private void initRotaPersonInfo(int year,int roundRule) { 
		try{
			if(roundRule==1)
				rotaOrders=rotaOrderManager.findAllRotaOrderByOrderDesc();
			else
				rotaOrders=rotaOrderManager.findAllRotaOrderByOrder();
			List<RotaPerson> rps=rotaPersonManager.findAllRotaPersonByYear(year);
			if(rps!=null && !rps.isEmpty()){
				for(RotaPerson rp:rps){
					rotaPersonManager.delRotaPerson(rp.getId());
				}
			}
			List<Date> dates= allWeekDateInfo(year);
			for(Date date :dates){
				Calendar cal=Calendar.getInstance();
				cal.setTime(date);
				int month=cal.get(Calendar.MONTH);
				int week=cal.get(Calendar.WEEK_OF_YEAR);
				if(cal.get(Calendar.DAY_OF_WEEK)!=1){//周六
					if (month >= 11 && week <= 1){  
				            week += 52;  
				    }  
					int nw=week+1;
					RotaOrder ro=new RotaOrder();
					if(nw<rotaOrders.size()+2){//第一轮
						ro=rotaOrders.get(nw-2);
					}else{//后续轮次
						inner:for(int k=0;k<=53/rotaOrders.size();k++){
							if((nw-1)-(rotaOrders.size()*k)>=0 && (nw-1)-(rotaOrders.size()*k)<=rotaOrders.size()){
								ro=rotaOrders.get((nw-2)-(rotaOrders.size()*(k)));
								break inner;
							}
						}
					}
					doCreateRotaOrder(nw,ro,date);
				}else{//周天
					if (month >= 11 && week <= 1) {
						week += 52;  
					} 
					int nw=week;
					RotaOrder ro=new RotaOrder();
					if(nw<rotaOrders.size()+2){//第一轮
						ro=rotaOrders.get(nw-2);
					}else{//后续轮次
						inner:for(int k=0;k<=53/rotaOrders.size();k++){
							if((nw-1)-(rotaOrders.size()*k)>=0 && (nw-1)-(rotaOrders.size()*k)<=rotaOrders.size()){
								ro=rotaOrders.get((nw-2)-(rotaOrders.size()*(k)));
								break inner;
							}
						}
					}
					doCreateRotaOrder(nw,ro,date);
				}
			}
			initRotaPersons();
			addSuccessMessage("周末值班表初始化成功!");
		}catch(Exception e){
			e.printStackTrace();
			addErrorMessage("发生异常，周末值班表初始化失败!");
		}
	}
	
	@SuppressWarnings("static-access")
	private void doCreateRotaOrder(int nw,RotaOrder ro,Date date){
		Calendar cal=Calendar.getInstance();
		cal.setTime(date);
		RotaPerson rp=new RotaPerson();
		rp.setId(ObjectId.get().toString());
		rp.setPersonId(ro.getPersonId());
		rp.setPersonName(ro.getPersonName());
		rp.setRotaDate(DateUtil.getDateByString(DateUtil.getStringDate(date, DateUtil.pattern_ymd),DateUtil.pattern_ymd));
		rp.setYear(cal.get(cal.YEAR));
		if(cal.get(Calendar.DAY_OF_WEEK)!=1){
			rp.setRemark("第"+(cal.get(Calendar.WEEK_OF_YEAR))+"周周六");
		}else{
			if(nw==53)
				rp.setRemark("第52周周日");
			else
				rp.setRemark("第"+(cal.get(Calendar.WEEK_OF_YEAR)-1)+"周周日");
		}
		rotaPersonManager.createRotaPerson(rp);
	}
		
	/**
	 * 初始化周末轮值表
	 */
	public void initRotaOrder() {
		rotaOrders = rotaOrderManager.findAllRotaOrder();
		/*if(rotaOrders==null && rotaOrders.isEmpty()){
			reInitRotaOrderInfo();
		}*/
		openSelectUserDialog();
	}
	
	public void openSelectUserDialog(){
    	Map<String,Object> options = new HashMap<String, Object>();
        options.put("resizable", false);
        options.put("draggable", false);
        options.put("modal", true);
        options.put("contentWidth", 500);
		options.put("contentHeight", 500);
        options.put("width", 310);
        options.put("height", 500);
        openDialog("/ui/common/org_selector_user_multiple", null, options);
	}
	
	@SuppressWarnings("unchecked")
	public void onUsersChosen(SelectEvent event) {
		List<PersonnelEntityBean> pebs = (List<PersonnelEntityBean>) event.getObject();
		if(pebs!=null && !pebs.isEmpty())
			reInitRotaOrderInfo(pebs);
	}
	
	/**
	 * 重新初始化周末轮值表
	 */
	public void reInitRotaOrderInfo(List<PersonnelEntityBean> pebs) {		
		Collections.sort(pebs, new Comparator<PersonnelEntityBean>(){
			@Override
			public int compare(PersonnelEntityBean peb1, PersonnelEntityBean peb2) {
				return PingYinUtil.getPingYin(peb1.getName()).compareTo(PingYinUtil.getPingYin(peb2.getName()));
			}
		});
		if(pebs!=null && !pebs.isEmpty()){
			if(rotaOrders!=null && !rotaOrders.isEmpty()){
				for(RotaOrder ro:rotaOrders){
					rotaOrderManager.delRotaRota(ro.getId());
				}
			}
			rotaOrders=new ArrayList<RotaOrder>();				
			int i=0;
			for(PersonnelEntityBean peb:pebs){
				RotaOrder rotaOrder=new RotaOrder();
				rotaOrder.setId(ObjectId.get().toString());
				rotaOrder.setPersonId(peb.getCode());
				rotaOrder.setPersonName(peb.getName());
				rotaOrder.setRotaCursor(0);
				rotaOrder.setRotaOrder(++i);
				rotaOrder=rotaOrderManager.createRotaOrder(rotaOrder);
				rotaOrders.add(rotaOrder);				
			}
		}
	}

	
	/**
	 * 重新初始化周末轮值表
	 */
	@Deprecated
	public void reInitRotaOrderInfo() {		
		DepartmentEntityBean deb=dm.findDepartmentById("5915851ea349462f78a1130e");//继电保护处
		if(deb!=null){
			List<PersonnelEntityBean> pebs = dm.findDeptPersonnels(deb.getId());
			Collections.sort(pebs, new Comparator<PersonnelEntityBean>(){
				@Override
				public int compare(PersonnelEntityBean peb1, PersonnelEntityBean peb2) {
					return PingYinUtil.getPingYin(peb1.getName()).compareTo(PingYinUtil.getPingYin(peb2.getName()));
				}
			});
			if(pebs!=null && !pebs.isEmpty()){
				if(rotaOrders!=null && !rotaOrders.isEmpty()){
					for(RotaOrder ro:rotaOrders){
						rotaOrderManager.delRotaRota(ro.getId());
					}
				}
				rotaOrders=new ArrayList<RotaOrder>();				
				int i=0;
				for(PersonnelEntityBean peb:pebs){
					RotaOrder rotaOrder=new RotaOrder();
					rotaOrder.setId(ObjectId.get().toString());
					rotaOrder.setPersonId(peb.getCode());
					rotaOrder.setPersonName(peb.getName());
					rotaOrder.setRotaCursor(0);
					rotaOrder.setRotaOrder(++i);
					rotaOrder=rotaOrderManager.createRotaOrder(rotaOrder);
					rotaOrders.add(rotaOrder);				
				}
			}
		}	
	}
	
	

	public void preCreateRotaOrder() {
		rotaOrder = new RotaOrder();
		initRotaOrder();
		rotaOrder.setRotaOrder(rotaOrders.size()+1);
	}
	
	public void preEditRotaOrder() {
		rotaOrder = selectRotaOrder;
	}
	
	public void saveRotaOrder() {
		if(rotaOrder != null) {
			if(rotaOrder.getId() == null) {//新建
				rotaOrderManager.createRotaOrder(rotaOrder);
				rotaOrders.add(rotaOrder);
			} else { //编辑
				//rotaOrders.set(rotaOrders.indexOf(rotaOrder), rotaOrder);
				rotaOrderManager.updateRotaOrder(rotaOrder);
				//selectRotaOrder = new RotaOrder();
			}
			addSuccessMessage("保存成功");
		}
	}
	
	public void deleteRotaOrder() {
		if(selectRotaOrder != null) {
			rotaOrderManager.delRotaRota(selectRotaOrder.getId());
			rotaOrders.remove(selectRotaOrder);
			addSuccessMessage("删除成功！");
		} else {
			addErrorMessage("请选择记录");
		}
		selectRotaOrder = null;
	}
	
	public void reInitHolidayRotaInfo(){
		initHolidayRotaInfo(Calendar.getInstance().get(Calendar.YEAR));
	}
    /**
     * 初始化当前年节假日值班信息
     * @param year
     */
    private void initHolidayRotaInfo(int year) {
		List<HolidayInfo> holidayInfos=holidayManager.getAllHolidayByYear(year);
		if(holidayInfos!=null && !holidayInfos.isEmpty()){
			for(HolidayInfo holidayInfo:holidayInfos){
				{
					boolean flag=initHolidayRotaInfo(holidayInfo,getCurrentUser().getCode());
					if(flag){
						holidayManager.updateHolidayInfo(holidayInfo);
					}
				}
			}		
		}
	}
    
	@SuppressWarnings("static-access")
	private boolean initHolidayRotaInfo(HolidayInfo holidayInfo,String loginCode){
		try{
				DepartmentEntityBean deb=dm.findPersonDepart(loginCode);
				List<PersonnelEntityBean> pebs= dm.findDeptPersonnels(deb.getId());
				if(deb!=null && pebs!=null && !pebs.isEmpty() && holidayDates!=null && !holidayDates.isEmpty()){
					for(Date date:holidayDates){
						for(PersonnelEntityBean peb:pebs){
							Calendar _cal=Calendar.getInstance();
							_cal.setTime(date);
	    					RotaInfo rotaInfo=new RotaInfo();
	    					rotaInfo.setId(ObjectId.get().toString());
	    					rotaInfo.setName(peb.getName());
	    					rotaInfo.setCoder(peb.getCode());
	    					rotaInfo.setDate(_cal.getTime());
	    					rotaInfo.setYear(_cal.get(_cal.YEAR));
	    					rotaInfo.setMonth(_cal.get(_cal.MONTH)+1);
	    					rotaInfo.setDay(_cal.get(_cal.DAY_OF_MONTH));
	    					rotaInfo.setNwOfMonth(_cal.get(_cal.WEEK_OF_MONTH));
	    					rotaInfo.setNwOfYear(_cal.get(_cal.WEEK_OF_YEAR));
	    					if(_cal.get(Calendar.DAY_OF_WEEK) == 1){
	    						rotaInfo.setWeek(7);
							}else{
								rotaInfo.setWeek(_cal.get(Calendar.DAY_OF_WEEK) - 1);
							}
	    					rotaInfo.setHoliday(true);
	    					rotaInfo.setHolidayName(holidayInfo.getHolidayName()); 
	    					rotaManager.saveRotaInfo(rotaInfo);
	    				}	
			    	}
			}
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
		return true;
	}
	

	
	 private List<Date> allWeekDateInfo(int year){
		List<Date> weekDayInfos=new ArrayList<Date>();
        Calendar calendar = new GregorianCalendar(year, 0, 1);
        int i = 1;
        while (calendar.get(Calendar.YEAR) < year + 1) {
            calendar.set(Calendar.WEEK_OF_YEAR, i++);
            calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
            if (calendar.get(Calendar.YEAR) == year) {
                weekDayInfos.add(calendar.getTime());
            }
            calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
            if (calendar.get(Calendar.YEAR) == year) {
                weekDayInfos.add(calendar.getTime());
            }
        }
        return weekDayInfos;
	 }
    
	public ScheduleModel getLazyEventModel() {
        return lazyEventModel;
    }
	
	//解决schedule页面显示的节假日提前一天问题
	public Date addOneDay(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		cal.add(Calendar.DAY_OF_MONTH, 1);
		return DateUtil.getDateByString(DateUtil.getStringDate(cal.getTime(), DateUtil.pattern_ymd),DateUtil.pattern_ymd);
	}
	
	//解决schedule页面显示的节假日提前一天问题
	public Date minusOneDay(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		cal.add(Calendar.DAY_OF_MONTH, -1);
		return DateUtil.getDateByString(DateUtil.getStringDate(cal.getTime(), DateUtil.pattern_ymd),DateUtil.pattern_ymd);
	}
	
	public String formatterDate(Date date){
		return DateUtil.getStringDate(date, DateUtil.pattern_ymd);
	}
	
    
    public ScheduleEvent getEvent() {
        return event;
    }
 
    public void setEvent(ScheduleEvent event) {
        this.event = event;
    }
     
    public void addEvent(ActionEvent actionEvent) {
        if(event.getId() == null)
        	lazyEventModel.addEvent(event);
        else
        	lazyEventModel.updateEvent(event);
         
        event = new DefaultScheduleEvent();
    }
     
    public void onEventSelect(SelectEvent selectEvent) {
    	_rotaPersons.clear();
    	event = (ScheduleEvent) selectEvent.getObject();
        _rotaPersons = rotaPersonManager.findRotaPersonByRoteDate(minusOneDay(event.getStartDate()));
        if(_rotaPersons!=null && !_rotaPersons.isEmpty())
        	rotaPerson = _rotaPersons.get(0);
    }
     
	
    public void onEventMove(ScheduleEntryMoveEvent event) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event moved", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
        addMessage(message);
    }
     
    public void onEventResize(ScheduleEntryResizeEvent event) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event resized", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
        addMessage(message);
    }
    
    public void onCellEdit(CellEditEvent event) {
		rotaPerson = rotaPersons.get(event.getRowIndex());
        if(null != rotaPerson) {
        	rotaPersonManager.updateRotaPerson(rotaPerson);
        }
		addSuccessMessage("修改成功!");
    }
     
    private void addMessage(FacesMessage message) {
        FacesContext.getCurrentInstance().addMessage(null, message);
    }

    
    public void onRotaPersonSelect(SelectEvent event) {
    	selectRotaPerson = (RotaPerson) event.getObject();
    }
    
    public void onRotaOrderSelect(SelectEvent event) {
    	selectRotaOrder = (RotaOrder) event.getObject();
    }
    
	public Date getRotaDate() {
		return rotaDate;
	}

	public void setRotaDate(Date rotaDate) {
		this.rotaDate = rotaDate;
	}

	public List<Date> getHolidayDates() {
		return holidayDates;
	}

	public void setHolidayDates(List<Date> holidayDates) {
		this.holidayDates = holidayDates;
	}
	
	public RotaOrder getRotaOrder() {
		return rotaOrder;
	}

	public void setRotaOrder(RotaOrder rotaOrder) {
		this.rotaOrder = rotaOrder;
	}

	public RotaOrder getSelectRotaOrder() {
		return selectRotaOrder;
	}

	public void setSelectRotaOrder(RotaOrder selectRotaOrder) {
		this.selectRotaOrder = selectRotaOrder;
	}

	public List<RotaOrder> getRotaOrders() {
		return rotaOrders;
	}

	public void setRotaOrders(List<RotaOrder> rotaOrders) {
		this.rotaOrders = rotaOrders;
	}
	
	public List<RotaPerson> get_rotaPersons() {
		return _rotaPersons;
	}

	public void set_rotaPersons(List<RotaPerson> _rotaPersons) {
		this._rotaPersons = _rotaPersons;
	}

	public List<RotaPerson> getRotaPersons() {
		return rotaPersons;
	}

	public void setRotaPersons(List<RotaPerson> rotaPersons) {
		this.rotaPersons = rotaPersons;
	}

	public RotaPerson getRotaPerson() {
		return rotaPerson;
	}

	public void setRotaPerson(RotaPerson rotaPerson) {
		this.rotaPerson = rotaPerson;
	}

	public String getSelectDate() {
		return selectDate;
	}

	public void setSelectDate(String selectDate) {
		this.selectDate = selectDate;
	}

	public RotaPerson getSelectRotaPerson() {
			return selectRotaPerson;
	}

	public void setSelectRotaPerson(RotaPerson selectRotaPerson) {
		this.selectRotaPerson = selectRotaPerson;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getRoundRule() {
		return roundRule;
	}

	public void setRoundRule(int roundRule) {
		this.roundRule = roundRule;
	}
	
	
}
